<template>
  <!-- 轮播图 -->
  <div class="block">
    <el-carousel :height="bannerHeight+'px'">
      <el-carousel-item v-for="item in list" :key="item.pictureUrl">
        <a :href="item.linkUrl" target="_blank" v-if="item.linkUrl">
          <img :src="item.pictureUrl" alt />
        </a>
        <img v-else :src="item.pictureUrl" alt />
      </el-carousel-item>
    </el-carousel>
  </div>
</template>

<script>
export default {
  name: "homeCarousel",
  props: {
    list: {
      type: Array,
      default() {
        return [];
      }
    }
  },
  data() {
    return {
      bannerHeight: 0
    };
  },
  mounted() {
    let sreenWidth = document.body.offsetWidth;
    let range = 400 / 1920;
    this.bannerHeight = range * sreenWidth;
  },
  methods: {}
};
</script>

<style scoped lang="scss">
</style>
